<%--
  Created by IntelliJ IDEA.
  User: 王文尧
  Date: 2024/7/15
  Time: 10:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>dataType为JSON的情况</title>
    <script type="text/javascript" src="js/jquery-3.7.1.min.js"></script>
</head>
<body>
    <script type="text/javascript">
        $.ajax({
            url:"AjaxServlet",
            type:"post",
            data:{
                op:"test2",
                sNo:"1001",
                sName:"王文尧"
            },
            dataType:"JSON",
            success:function (data){
               console.log(data);
                for (var i = 0; i < data.length; i++) {
                    console.log(data[i].aNo + "--" + data[i].aName);
                }
            }
        });
    </script>
</body>
</html>
